from pathlib import Path
import redis

# 获取根路径
BASE_DIR = Path(__file__).resolve().parent.parent

DEBUG = True
SECRET_KEY = "hello word"

HOSTNAME = '127.0.0.1'
# HOSTNAME = '10.150.3.42'
POST = '3306'
DATABASE = 'recruit'
USERNAME = 'root'
PASSWORD = ''
# PASSWORD = 'Admin2020.'


DB_URI = 'mysql://{}:{}@{}:{}/{}?charset=utf8'.format(USERNAME, PASSWORD, HOSTNAME, POST, DATABASE)
SQLALCHEMY_DATABASE_URI = DB_URI
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
SQLALCHEMY_TRACK_MODIFICATIONS = True

# redis
REDIS_HOST = "127.0.0.1"
# REDIS_HOST = "10.150.3.42"
REDIS_PORT = 6379
# flask_session配置
SESSION_TYPE = "redis"
SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT,decode_responses=True)

redis_store=SESSION_REDIS
# 对cookie中session_id进行隐藏处理
SESSION_USE_SIGNER = True
# session数据的有效期，单位秒
PERMANENT_SESSION_LIFETIME = 86400